﻿using BaseAuthRole.AspNetCore.Filters;
using FreeSql.Internal.Model;
using log4net;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RS.BaseModel;
using RS.BaseModel.Common;
using TPWorkPlat.DTO.Input;
using TPWorkPlat.DTO.Output;
using TPWorkPlat.Entity;
using TPWorkPlat.IService;

namespace TPWorkPlat.Server.Api
{
    /// <summary>
    /// 专家信息相关接口
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ExpertController : ControllerBase
    {
        private ITheoryStudyService _theoryStudyService;

        private ILog logger = log4net.LogManager.GetLogger("ExpertController");
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="theoryStudyService"></param>
        public ExpertController(ITheoryStudyService theoryStudyService) {

            _theoryStudyService = theoryStudyService;
        }
        #region 专家信息相关接口
        /// <summary>
        /// 获取专家信息分页列表
        /// </summary>
        /// <param name="theoryStudyGetListAndPageInfoInput">查询条件 Logic传数值即可例：0,参考[0:And,1:Or];Operator传数值即可例：0，参考[0:Contains,1:StartsWith,2:EndsWith,3:NotContains,4:NotStartsWith,5:NotEndsWith,6:Equal,7:Equals,8:Eq,9:NotEqual,10:GreaterThan,11:GreaterThanOrEqual,12:LessThan,13:LessThanOrEqual,14:Range,15:DateRange,16:Any,17:NotAny]</param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetExpertInfoList([FromBody] TheoryStudyGetListAndPageInfoInput theoryStudyGetListAndPageInfoInput)
        {
            var r = _theoryStudyService.GetExpertInfoListAndPageInfo<ExpertInfoOutput>(theoryStudyGetListAndPageInfoInput);

            return Ok(r);
        }
        /// <summary>
        /// 获取专家信息详情
        /// </summary>
        /// <param name="bauim">传入Id即可</param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetExpertInfoDetail([FromQuery] BaseAppAndUserInputModel bauim)
        {
            var r = _theoryStudyService.GetExpertInfoFromId(bauim);

            return Ok(r);
        }
        #endregion
        #region 专家成果相关接口
        /// <summary>
        /// 获取专家成果分页列表
        /// </summary>
        /// <param name="theoryStudyGetListAndPageInfoInput">查询条件 Logic传数值即可例：0,参考[0:And,1:Or];Operator传数值即可例：0，参考[0:Contains,1:StartsWith,2:EndsWith,3:NotContains,4:NotStartsWith,5:NotEndsWith,6:Equal,7:Equals,8:Eq,9:NotEqual,10:GreaterThan,11:GreaterThanOrEqual,12:LessThan,13:LessThanOrEqual,14:Range,15:DateRange,16:Any,17:NotAny]</param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetExpertAchievementsList([FromBody] TheoryStudyGetListAndPageInfoInput theoryStudyGetListAndPageInfoInput)
        {
            var r = _theoryStudyService.GetExpertAchievementsListAndPageInfo<ExpertAchievementsOuntput>(theoryStudyGetListAndPageInfoInput);

            return Ok(r);
        }
        /// <summary>
        /// 获取专家信息详情
        /// </summary>
        /// <param name="bauim">传入Id即可</param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetExpertAchievementsDetail([FromQuery] BaseAppAndUserInputModel bauim)
        {
            var r = _theoryStudyService.GetExpertAchievementsFromId(bauim);

            return Ok(r);
        }
        #endregion
    }
}
